import { defineAmisPlugin, getInputTpl, getStyleTpl } from '../../base/util';
import Banner, { type IProps } from './fc';

export default defineAmisPlugin<IProps>(({ amisEditor }) => {
  const { getSchemaTpl } = amisEditor;

  return {
    component: Banner,
    options: {
      type: 'portal-banner',
      order: 4,
      name: '宣传栏',
      icon: 'CloudServerOutlined',
      description: '自定义宣传栏',
      panelTitle: '宣传栏',
      scaffold: {
        title: 'Hi，欢迎使用建造一体化平台!',
        desc: '一站式应用管理入口，实现单点登录，实现业务信息聚合，打造千人千面的个性化工作台',
        style: { padding: 24 }
      },
      panelTabs: [
        {
          title: '内容',
          body: [
            getSchemaTpl('collapseGroup', [
              {
                title: '标题',
                body: [
                  getInputTpl('title', { type: 'textarea' }),
                  ...getStyleTpl('titleStyle'),
                ],
              },
              {
                title: '描述',
                body: [
                  getInputTpl('desc', { type: 'textarea' }),
                  ...getStyleTpl('descStyle'),
                ],
              },
            ]),
          ],
        },
        {
          title: '外观',
          body: [
            getSchemaTpl('collapseGroup', [
              ...getSchemaTpl('theme:common', { styleName: 'style' }),
            ]),
          ],
        },
      ],
    },
  };
});
